package com.zjc.app.api.sdk.client;

import com.google.gson.reflect.TypeToken;
import com.zjc.app.api.sdk.dto.ResultDto;
import com.zjc.app.api.sdk.dto.request.ApiDeviceFenceOperateReqDTO;
import com.zjc.app.api.sdk.dto.result.ApiDeviceFenceResultDTO;
import com.zjc.app.api.sdk.exception.AppBizRuntimeException;

import java.io.IOException;

/**
 * 电子围栏相关API
 */
public class GeographyFenceClient extends BaseClient {

    public GeographyFenceClient(String serverUrl, String appId, String appSecret, Integer connectTimeout, Integer readTimeout) {
        super(serverUrl, appId, appSecret, connectTimeout, readTimeout);
    }

    /**
     * (创建/修改/删除) 设备电子围栏
     * @param request
     * @return
     * @throws IOException
     * @throws AppBizRuntimeException
     */
    public ResultDto<ApiDeviceFenceResultDTO> operateDeviceFence(ApiDeviceFenceOperateReqDTO request) throws IOException, AppBizRuntimeException {
        String url = "/v1/device/fence.operate";
        return super.doPost(url, request, new TypeToken<ResultDto<ApiDeviceFenceResultDTO>>() {});
    }
}
